#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main()
{

string a;
cin >> a;
vector <char> s;
int k = 0;
char c;
for(int i = 0; i < a.length(); i ++)
	if (a[i] == '(' || a[i] == '[' || a[i] == '{' || a[i] == '<'){
		s.push_back(a[i]);
	}
	else{
		if (s.size() != 0){
			c = s[s.size() - 1];
			s.pop_back();
			if (!(c == '(' && a[i] == ')' || c == '[' && a[i] == ']' || c == '{' && a[i] == '}' || c == '<' && a[i] == '>')){
				cout<<"False";
				k = k + 1;
				break;
			}
		}
		else{
		    cout<<"False";
		    k = k + 1;
		    break;
		}
	}
if (s.size() == 0 && k != 1){
	cout<<"True";
	}
else if (s.size() != 0 && k!= 1){
    cout<<"False";
}
}